
#include "GameLogic.h"

//------------
//--- Game ---
//------------

void Game::ApplyAction(const GameAction &action)
{
	_lastAction = action;
	_field(action.GetX(), action.GetY()).SetOwner(action.GetPlayer());
}

void Game::GetDotsCount(size_t &player1, size_t &player2, size_t &untaken)
{
	player1 = 0;
	player2 = 0;
	untaken = 0;
	for (size_t x = 0; x < _field.GetWidth(); x++)
		for (size_t y = 0; y < _field.GetHeight(); y++)
			switch (_field(x, y).GetOwner())
			{
				case Player1:
					player1++;
					break;

				case Player2:
					player2++;
					break;

				case None:
					untaken++;
					break;
			}
}
